#ifndef ADDRESS_SPACE_H
#define ADDRESS_SPACE_H

#include <Types.h>
#include <BuddyAllocator.h>
#include <RadixTree.h>
#include <Inode.h>



class AddressSpace: public RadixTree{
	Inode *inode;
	public:
		AddressSpace(Inode *ind){
			inode = ind;
		}
		Frame * getFrame(pg_size index){
			uint32 blocks;
			Frame *frm = (Frame *) getNode(index);
			kprintf("AS_FRM FOULT: %X\n", frm);
			if(!frm){
				frm = zone_normal->_allocFrame(0);
				kprintf("TO_FRM: %X %X %X\n", frm, _frm_to_addr(frm), mem_map);
				if((blocks = inode->readBlock((addr_t *)_va(_frm_to_addr(frm)), index)) > 0){
					kprintf("Blocks: %i\n", blocks);
					insertNode(index, frm);
				}
			}
			return frm;
		}
};

#endif /* ADDRESS_SPACE_H */

